home *** CD-ROM | disk | FTP | other *** search
Gui4CLI script | 1980-01-03 | 6.4 KB | 252 lines |
- G4C
-
- ; This file contains a routine, to read the file selected according
- ; to it's type. You can add type checks here, to your heart's content.
-
- ; The following things MUST be done before it's called :
-
- ; 1. Load the DEF.player variables by first gui-loading the
- ; guis:tools/prefs/players file.
-
- ; 2. Set GLOBAL variable FILENAME to the name of file to be viewed
-
- ; 3. (Optional) Set GLOBAL variable RUNMODE.
- ; The file chosen will (in most cases) be executed as follows :
- ; CLI '$RUNMODE $DEF.player $FILENAME'
- ; - so if RUNMODE = 'run >nil:'
- ; then the file will be run - otherwise, if not set, the file will
- ; be CLI'ied i.e. executed synchronously and Gui4Cli will wait until
- ; finished. This is helpfull if you want to show many pictures for
- ; example, where you don't want to show them all at once but 1 by 1.
-
- ; The RUNMODE variable will be reset to '' upon exit.
-
-
- varpath '*/cli.gc' ; use the global variable path
-
- xOnQuit
- guiquit ViewMore
-
- ; This is the start of the one and only routine in this gui
-
- xRoutine ViewFile
- runmode = $*RUNMODE ; store runmode
- *RUNMODE = '' ; and null the variable
- if $FILENAME < " " ; FILENAME variable was not set..
- return
- endif
- extract FILENAME file rtn.temp ; see if it's a module
- cutvar rtn.temp copy char 4 rtn.mod
- delvar rtn.temp
- if $rtn.mod == mod.
- run '$DEF.MOD $FILENAME'
- delvar rtn.mod
- return
- endif
-
- extract FILENAME ext rtn.ext
- docase $rtn.ext
- case = ".info"
- copy $FILENAME ram:t ; load gui which will show an icon
- ifexists file ram:t/GCXX.info ; named ram:t/GCXX.info
- delete ram:t/GCXX.info
- endif
- extract FILENAME FILE rtn_info2
- joinfile ram:t $rtn_info2 rtn_info
- rename $rtn_info ram:t/GCXX.info
- guiload guis:tools/icon.gc
- guiopen icon.gc
- guiscreen icon.gc front
- return
- break
- case = ".gif"
- CLI '$runmode $DEF.GIF $FILENAME'
- return
- break
- case = ".ppm"
- CLI 'run >NIL: ppm2aga $FILENAME T:temp'
- WAIT FILE T:Temp 1000
- CLI '$runmode $DEF.ILBM T:temp'
- RUN 'delete T:temp'
- return
- break
- case = ".tga"
- case = ".pgm"
- case = ".png"
- case = ".font"
- CLI '$runmode $DEF.MULTIVIEW $FILENAME'
- return
- break
- case = ".S3M"
- case = ".mod"
- case = ".XM"
- CLI '$runmode $DEF.MOD $FILENAME'
- return
- break
- endcase
-
- ; We reached here so we have to check the type of file using the
- ; header comparisson. To do this faster than with H=, we would use:
- ; readvar $FILENAME 0 100 header
- ; but it's not ready yet...
-
- docase $FILENAME
- case H= "ã" ; icon probably
- copy $FILENAME ram:t ; load gui which will show an icon
- ifexists file ram:t/GCXX.info ; named ram:t/GCXX.info
- delete ram:t/GCXX.info
- endif
- extract FILENAME FILE rtn_info2
- joinfile ram:t $rtn_info2 rtn_info
- rename $rtn_info ram:t/GCXX.info
- guiload guis:tools/icon.gc
- guiopen icon.gc
- guiscreen icon.gc front
- return
- break
- case H= "FORM????ILBM" ; ILBM
- CLI '$runmode $DEF.ILBM $FILENAME'
- return
- break
- case H= "FORM????ANIM" ; Animation
- CLI '$runmode $DEF.ANIM $FILENAME'
- return
- break
- case H= "GIF" ; GIF
- CLI '$runmode $DEF.GIF $FILENAME'
- return
- break
- case H= "??????JFIF" ; JPEG
- case H= "ÿØÿÄ" ; JPEG
- CLI '$runmode $DEF.JPG $FILENAME'
- return
- break
- case H= "?PNG" ; PNG
- case H= "P5" ; PGM
- CLI '$runmode $DEF.MULTIVIEW $FILENAME'
- return
- break
- case H= "P6" ; PPM - don't ask..
- CLI 'ppm2aga $FILENAME T:temp'
- WAIT FILE T:Temp 1000
- CLI '$runmode $DEF.MULTIVIEW T:temp'
- RUN 'delete T:temp'
- return
- break
- case H= "MMD" ; MED
- case H= "Extended Module:" ; XM
- case H= "????????????????????????????????????????????SCRM" ; S3M Scream Tracker 3
- case H= "?????????????????????????????????????????????@" ; I forget
- CLI '$runmode $DEF.MOD $FILENAME'
- return
- break
- case H= "FORM????8SVX" ; 8svx Sound sample
- CLI '$runmode $DEF.8SVX $FILENAME'
- return
- break
- case H= "PP" ; PowerPacked file
- CLI '$runmode $DEF.PP $FILENAME'
- return
- break
- case H= G4C ; Yes.. you guessed it.
- GuiLoad $FILENAME
- return
- break
- case H= "??-lh" ; LhA - all these are CLI'ied
- cli 'Lha x $FILENAME ram:'
- return
- break
- case H= "ZOO ?.??" ; zoo
- cli 'Zoo <* x// $FILENAME'
- return
- break
- ;case H= ^Z ; pkax
- ; cli 'pkax -x $FILENAME'
- ; return
- ; break
- case H= "PK" ; unzip
- cli 'unzip $FILENAME -d ram:'
- return
- break
- case H= "@" ; Amigaguide (probably)
- CLI '$runmode $DEF.GUIDE $FILENAME'
- return
- break
- case H= "%%%ó%" ; A program ? - Use cli.gc to run it.
- GuiLoad guis:tools/cli.gc
- setvar cl_Main '$FILENAME'
- GuiOpen cli.gc
- GuiScreen cli.gc front
- update cli.gc 10 2 ; set it to RUN
- setgad cli.gc 1 ON
- return
- break
- case H= "######" ; a text file (probably)
- GuiLoad guis:tools/read.gc
- guiopen read.gc
- GuiWindow read.gc FRONT
- GuiScreen read.gc FRONT
- return
- break
- endcase
-
- ; If we got this far, let user decide what to do
- guiopen ViewMore
-
-
- ; ######################################################################
-
- NEWFILE ViewMore ; gui to decide what to do with unresolved files
-
- WinBig 0 0 80 75 ""
- WinType 01001000
- winonmouse 40 10
- varpath ViewFile.g/*/cli.gc
-
- xOnRMB
- guiclose ViewMore
-
- xOnInactive
- guiclose ViewMore
-
- xOnFail
- ezreq "Error during operation" OK ""
-
- ;---------------> the Buttons
-
- xbutton 0 0 0 15 MView
- guiclose ViewMore
- CLI '$runmode $DEF.MULTIVIEW $FILENAME'
-
- xbutton 0 15 0 15 List
- GuiLoad guis:tools/read.gc
- guiopen read.gc
- GuiWindow read.gc FRONT
- GuiScreen read.gc FRONT
- return
- break
-
- xbutton 0 30 0 15 Run
- guiclose ViewMore
- run '$FILENAME'
-
- xbutton 0 45 0 15 With..
- guiclose ViewMore
- prog = ''
- ReqFile -1 -1 300 220 'Run file with..' LOAD prog c:
- if $prog > ''
- run '$prog $FILENAME'
- endif
- delvar prog
-
- xbutton 0 60 0 15 'CliGui'
- guiclose ViewMore
- setvar cl_Main '$FILENAME '
- GuiLoad guis:tools/cli.gc
- GuiOpen cli.gc
- GuiScreen cli.gc front
- update cli.gc 10 1 ; set it to CLI
- setgad cli.gc 1 ON
-
-
-